import Vue from 'vue'
import singleSpaVue from 'single-spa-vue'
// 子应用是vue，安装single-spa-vue模块

import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

const appOptions = {
  el: '#vue', // 挂载到父应用的id为vue的标签上
  router,
  store,
  render: h => h(App)
}

// 如果是父应用引用
if (window.singleSpaNavigate) {
  __webpack_public_path__ = 'http://localhost:8081/'
}

if (!window.singleSpaNavigate) { // 独立模块
  delete appOptions.el
  new Vue(appOptions).$mount('#app')
}



const vueLifeCycle = singleSpaVue({
  Vue, 
  appOptions
})

console.log(vueLifeCycle.bootstrap)

export const bootstrap = vueLifeCycle.bootstrap;
export const unmount = vueLifeCycle.unmount;
export const mount = vueLifeCycle.mount;
export const update = vueLifeCycle.update;

// singleSpaVue暴露三个周期方法
// bootstrap mount unmount

// 需要父应用去加载子应用，将子应用打包成一个个的lib，给父应用使用
